
<!DOCTYPE HTML>
<html lang="zh-hans" >
    <head>
        <meta charset="UTF-8">
        <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
        <title>基础 · 千锋大前端小册-Electron</title>
        <meta http-equiv="X-UA-Compatible" content="IE=edge" />
        <meta name="description" content="">
        <meta name="generator" content="GitBook 3.2.3">
        <meta name="author" content="古艺散人">
        
        
    
    <link rel="stylesheet" href="../gitbook/style.css">

    
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-splitter/splitter.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchors/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-anchor-navigation-ex/style/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-insert-logo/plugin.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-highlight/website.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-search/search.css">
                
            
                
                <link rel="stylesheet" href="../gitbook/gitbook-plugin-fontsettings/website.css">
                
            
        

    

    
        
    

        
    
    
    
    
    <meta name="HandheldFriendly" content="true"/>
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link rel="apple-touch-icon-precomposed" sizes="152x152" href="../gitbook/images/apple-touch-icon-precomposed-152.png">
    <link rel="shortcut icon" href="../gitbook/images/favicon.ico" type="image/x-icon">

    
    <link rel="next" href="01-Electron介绍.html" />
    
    
    <link rel="prev" href="../" />
    

    
        <link rel="shortcut icon" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="bookmark" href='../source/images/favicon.jpg' type="image/x-icon">
    
    
        <link rel="apple-touch-icon" href='../source/images/apple-touch-icon.jpg'>
    
    
        
        <link rel="apple-touch-icon" sizes="120x120" href="../source/images/apple-touch-icon.jpg">
        
        <link rel="apple-touch-icon" sizes="180x180" href="../source/images/apple-touch-icon.jpg">
        
    

    <style>
    @media only screen and (max-width: 640px) {
        .book-header .hidden-mobile {
            display: none;
        }
    }
    </style>
    <script>
        window["gitbook-plugin-github-buttons"] = {"buttons":[{"user":"lurongtao","repo":"felixbooks-electron","type":"star","size":"small","count":true}]};
    </script>

    </head>
    <body>
        
<div class="book">
    <div class="book-summary">
        
            
<div id="book-search-input" role="search">
    <input type="text" placeholder="输入并搜索" />
</div>

            
                <nav role="navigation">
                


<ul class="summary">
    
    

    

    
        
        
    
        <li class="chapter " data-level="1.1" data-path="../">
            
                <a href="../">
            
                    
                    前言
            
                </a>
            

            
        </li>
    
        <li class="chapter active" data-level="1.2" data-path="01-Electron介绍.html">
            
                <a href="01-Electron介绍.html">
            
                    
                    基础
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter active" data-level="1.2.1" data-path="01-Electron介绍.html">
            
                <a href="01-Electron介绍.html">
            
                    
                    01-Electron介绍
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.2" data-path="02-搭建Electron运行环境.html">
            
                <a href="02-搭建Electron运行环境.html">
            
                    
                    02-搭建Electron运行环境
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.3" data-path="03-Main Process API.html">
            
                <a href="03-Main Process API.html">
            
                    
                    03-Main Process API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.4" data-path="04-Renderer Process API.html">
            
                <a href="04-Renderer Process API.html">
            
                    
                    04-Renderer Process API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.5" data-path="05-IPC通信.html">
            
                <a href="05-IPC通信.html">
            
                    
                    05-IPC通信
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.6" data-path="06-Shared API.html">
            
                <a href="06-Shared API.html">
            
                    
                    06-Shared API
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.2.7" data-path="07-特性和技巧.html">
            
                <a href="07-特性和技巧.html">
            
                    
                    07-特性和技巧
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.3" data-path="../project/">
            
                <a href="../project/">
            
                    
                    项目实战
            
                </a>
            

            
            <ul class="articles">
                
    
        <li class="chapter " data-level="1.3.1" data-path="../project/01-环境搭建.html">
            
                <a href="../project/01-环境搭建.html">
            
                    
                    01-环境搭建
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.2" data-path="../project/02-构建项目基本结构.html">
            
                <a href="../project/02-构建项目基本结构.html">
            
                    
                    02-构建项目基本结构
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.3" data-path="../project/03-添加信息.html">
            
                <a href="../project/03-添加信息.html">
            
                    
                    03-添加信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.4" data-path="../project/04-获得屏幕快照.html">
            
                <a href="../project/04-获得屏幕快照.html">
            
                    
                    04-获得屏幕快照
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.5" data-path="../project/05-显示列表.html">
            
                <a href="../project/05-显示列表.html">
            
                    
                    05-显示列表
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.6" data-path="../project/06-打开网站窗口.html">
            
                <a href="../project/06-打开网站窗口.html">
            
                    
                    06-打开网站窗口
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.7" data-path="../project/07-删除信息.html">
            
                <a href="../project/07-删除信息.html">
            
                    
                    07-删除信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.8" data-path="../project/08-搜索信息.html">
            
                <a href="../project/08-搜索信息.html">
            
                    
                    08-搜索信息
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.9" data-path="../project/09-定制菜单.html">
            
                <a href="../project/09-定制菜单.html">
            
                    
                    09-定制菜单
            
                </a>
            

            
        </li>
    
        <li class="chapter " data-level="1.3.10" data-path="../project/10-项目打包部署.html">
            
                <a href="../project/10-项目打包部署.html">
            
                    
                    10-项目打包部署
            
                </a>
            

            
        </li>
    

            </ul>
            
        </li>
    
        <li class="chapter " data-level="1.4" data-path="../thanks/">
            
                <a href="../thanks/">
            
                    
                    感谢
            
                </a>
            

            
        </li>
    

    

    <li class="divider"></li>

    <li>
        <a href="https://www.gitbook.com" target="blank" class="gitbook-link">
            本书使用 GitBook 发布
        </a>
    </li>
</ul>


                </nav>
            
        
    </div>

    <div class="book-body">
        
            <div class="body-inner">
                
                    

<div class="book-header" role="navigation">
    

    <!-- Title -->
    <h1>
        <i class="fa fa-circle-o-notch fa-spin"></i>
        <a href=".." >基础</a>
    </h1>
</div>




                    <div class="page-wrapper" tabindex="-1" role="main">
                        <div class="page-inner">
                            
<div id="book-search-results">
    <div class="search-noresults">
    
                                <section class="normal markdown-section">
                                
                                <div id="anchor-navigation-ex-navbar"><i class="fa fa-navicon"></i><ul><li><span class="title-icon "></span><a href="#electron-&#x4ECB;&#x7ECD;"><b></b>Electron &#x4ECB;&#x7ECD;</a></li><ul><ul><li><span class="title-icon "></span><a href="#1&#x3001;&#x6982;&#x89C8;"><b></b>1&#x3001;&#x6982;&#x89C8;</a></li><li><span class="title-icon "></span><a href="#2&#x3001;electron-&#x539F;&#x7406;"><b></b>2&#x3001;Electron &#x539F;&#x7406;</a></li></ul></ul></ul></div><a href="#electron-&#x4ECB;&#x7ECD;" id="anchorNavigationExGoTop"><i class="fa fa-arrow-up"></i></a><h1 id="electron-&#x4ECB;&#x7ECD;"><a name="electron-&#x4ECB;&#x7ECD;" class="anchor-navigation-ex-anchor" href="#electron-&#x4ECB;&#x7ECD;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="electron-&#x4ECB;&#x7ECD;" class="plugin-anchor" href="#electron-&#x4ECB;&#x7ECD;"><i class="fa fa-link" aria-hidden="true"></i></a>Electron &#x4ECB;&#x7ECD;</h1>
<h3 id="1&#x3001;&#x6982;&#x89C8;"><a name="1&#x3001;&#x6982;&#x89C8;" class="anchor-navigation-ex-anchor" href="#1&#x3001;&#x6982;&#x89C8;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="1&#x3001;&#x6982;&#x89C8;" class="plugin-anchor" href="#1&#x3001;&#x6982;&#x89C8;"><i class="fa fa-link" aria-hidden="true"></i></a>1&#x3001;&#x6982;&#x89C8;</h3>
<p>&#x60F3;&#x5FC5;&#x4F60;&#x5DF2;&#x7ECF;&#x542C;&#x8BF4;&#x4E86;&#x53EF;&#x4EE5;&#x5E94;&#x7528;electron&#x6765;&#x6784;&#x5EFA;&#x4EE4;&#x4EBA;&#x60CA;&#x53F9;&#x7684;&#x684C;&#x9762;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF01;</p>
<p><img src="images/Snip20200301_16.png" style="width:500px;"></p>
<p>&#x5355;&#x7EAF;&#x4F7F;&#x7528;JavaScript API &#x5C31;&#x53EF;&#x4EE5;&#x6784;&#x5EFA;Mac, windows&#x6216;&#x8005;Linux&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</p>
<p>&#x957F;&#x671F;&#x4EE5;&#x6765;&#xFF0C;&#x5F88;&#x591A;&#x5F00;&#x53D1;&#x8BED;&#x8A00;&#x90FD;&#x4FDD;&#x7559;&#x4E86;&#x751F;&#x6210;&#x684C;&#x9762;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x7684;&#x529F;&#x80FD;&#xFF0C;&#x6BD4;&#x5982;C&#x548C;Java&#xFF0C;&#x4F46;&#x662F;&#x7528;&#x8FD9;&#x4E9B;&#x8BED;&#x8A00;&#x6765;&#x6784;&#x5EFA;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x662F;&#x975E;&#x5E38;&#x56F0;&#x96BE;&#x7684;&#x3002;</p>
<p><img src="images/Snip20200301_17.png" style="width:500px;"></p>
<p>&#x5F53;&#x7136;&#xFF0C;&#x8FD1;&#x5E74;&#x6765;&#xFF0C;&#x6784;&#x5EFA;&#x672C;&#x5730;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x53D8;&#x7684;&#x66F4;&#x52A0;&#x7075;&#x6D3B;&#xFF0C;&#x4F46;&#x60A8;&#x4ECD;&#x7136;&#x9700;&#x8981;&#x4E3A;&#x6BCF;&#x4E2A;&#x64CD;&#x4F5C;&#x7CFB;&#x7EDF;&#x5B66;&#x4E60;&#x4E0D;&#x540C;&#x7684;&#x8BED;&#x8A00;&#x5E76;&#x4F7F;&#x7528;&#x975E;&#x5E38;&#x7279;&#x5B9A;&#x7684;&#x5DE5;&#x5177;&#x8FDB;&#x884C;&#x5F00;&#x53D1;&#x3002;</p>
<p><img src="images/Snip20200301_18.png" style="width:500px;"></p>
<p>&#x800C;&#x5982;&#x4ECA;&#xFF0C;&#x5728;Mac&#xFF0C;Windows&#x548C;Linux&#x7CFB;&#x7EDF;&#x4E0A;&#xFF0C;&#x5E94;&#x7528;Electron&#x6280;&#x672F;&#xFF0C;&#x53EF;&#x4EE5;&#x4F7F;&#x6211;&#x4EEC;&#x524D;&#x7AEF;&#x5F00;&#x53D1;&#x4EBA;&#x5458;&#x8FD0;&#x7528;&#x73B0;&#x6709;&#x7684;&#x77E5;&#x8BC6;&#x6765;&#x89E3;&#x51B3;&#x8FD9;&#x4E2A;&#x95EE;&#x9898;&#x4E86;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x5229;&#x7528;JavaScript&#xFF0C;HTML&#x548C;CSS&#x8FD9;&#x4E9B;Web&#x6280;&#x672F;&#x6765;&#x6784;&#x5EFA;&#x5355;&#x4E2A;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#xFF0C;&#x7136;&#x540E;&#x4E3A;Mac windows &#x548C; Linux &#x7F16;&#x8BD1;&#x8BE5;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</p>
<p><img src="images/Snip20200301_20.png" style="width:500px;"></p>
<p>&#x8FD9;&#x6837;&#xFF0C;&#x6211;&#x4EEC;&#x5C31;&#x4E0D;&#x7528;&#x4E3A;&#x7279;&#x5B9A;&#x7684;&#x5E73;&#x53F0;&#x7EF4;&#x62A4;&#x4E0D;&#x540C;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x4E86;&#x3002;</p>
<p>&#x6B64;&#x5916;&#xFF0C;&#x6211;&#x4EEC;&#x8FD8;&#x53EF;&#x4EE5;&#x4F7F;&#x7528;&#x6211;&#x4EEC;&#x559C;&#x6B22;&#x7684;&#x6846;&#x67B6;&#x548C;&#x5E93;&#x6765;&#x5B9E;&#x73B0;&#x8FD9;&#x4E2A;&#x7A0B;&#x5E8F;&#xFF0C;&#x6BD4;&#x5982; Vue, React &#x7B49;&#x524D;&#x7AEF;&#x6846;&#x67B6;&#x3002;</p>
<p><img src="images/Snip20200301_21.png" style="width:500px;"></p>
<p>Electron&#x5F00;&#x53D1;&#x5229;&#x7528;&#x7684;&#x662F;&#x7EAF; Web &#x6280;&#x672F;&#xFF0C;&#x5979;&#x57FA;&#x4E8E; Chromium &#x548C; Node.js, &#x8BA9;&#x4F60;&#x53EF;&#x4EE5;&#x4F7F;&#x7528; HTML, CSS &#x548C; JavaScript &#x6784;&#x5EFA;&#x5E94;&#x7528;&#x3002;</p>
<p><img src="images/Snip20200301_22.png" style="width:500px;"></p>
<p>Electron&#x5B8C;&#x5168;&#x5F00;&#x6E90;&#xFF0C;&#x5979;&#x662F;&#x4E00;&#x4E2A;&#x7531; GitHub &#x53CA;&#x4F17;&#x591A;&#x8D21;&#x732E;&#x8005;&#x7EC4;&#x6210;&#x7684;&#x6D3B;&#x8DC3;&#x793E;&#x533A;&#x5171;&#x540C;&#x7EF4;&#x62A4;&#x7684;&#x5F00;&#x6E90;&#x9879;&#x76EE;&#x3002;</p>
<p><img src="images/Snip20200301_23.png" style="width:500px;"></p>
<p>Electron&#x5B8C;&#x5168;&#x8DE8;&#x5E73;&#x53F0;&#xFF0C;&#x5979;&#x517C;&#x5BB9; Mac&#x3001;Windows &#x548C; Linux&#xFF0C;&#x53EF;&#x4EE5;&#x6784;&#x5EFA;&#x51FA;&#x4E09;&#x4E2A;&#x5E73;&#x53F0;&#x7684;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002;</p>
<p><img src="images/Snip20200301_25.png" style="width:500px;"></p>
<p>&#x5982;&#x679C;&#x4F60;&#x53EF;&#x4EE5;&#x5EFA;&#x4E00;&#x4E2A;&#x7F51;&#x7AD9;&#xFF0C;&#x4F60;&#x5C31;&#x53EF;&#x4EE5;&#x5EFA;&#x4E00;&#x4E2A;&#x684C;&#x9762;&#x5E94;&#x7528;&#x7A0B;&#x5E8F;&#x3002; Electron &#x662F;&#x4E00;&#x4E2A;&#x4F7F;&#x7528; JavaScript, HTML &#x548C; CSS &#x7B49; Web &#x6280;&#x672F;&#x521B;&#x5EFA;&#x539F;&#x751F;&#x7A0B;&#x5E8F;&#x7684;&#x6846;&#x67B6;&#xFF0C;&#x5B83;&#x8D1F;&#x8D23;&#x6BD4;&#x8F83;&#x96BE;&#x641E;&#x7684;&#x90E8;&#x5206;&#xFF0C;&#x4F60;&#x53EA;&#x9700;&#x628A;&#x7CBE;&#x529B;&#x653E;&#x5728;&#x4F60;&#x7684;&#x5E94;&#x7528;&#x7684;&#x6838;&#x5FC3;&#x4E0A;&#x5373;&#x53EF;&#x3002;Electron,&#x4E00;&#x5B9A;&#x6BD4;&#x4F60;&#x60F3;&#x8C61;&#x7684;&#x66F4;&#x7B80;&#x5355;&#xFF01;&#xFF01;</p>
<p><img src="images/Snip20200301_26.png" style="width:500px;"></p>
<p>Electron &#x6700;&#x521D;&#x4E3A; GitHub &#x5F00;&#x53D1; Atom &#x7F16;&#x8F91;&#x5668;,  &#x6B64;&#x540E;&#x88AB;&#x4E16;&#x754C;&#x5404;&#x5730;&#x7684;&#x516C;&#x53F8;&#x91C7;&#x7EB3;&#x3002;&#x6BD4;&#x5982;Slack, &#x751A;&#x81F3;&#x5FAE;&#x8F6F;&#x81EA;&#x5DF1;&#x7684;Visual Studio&#x3002;</p>
<p><img src="images/Snip20200301_27.png" style="width:500px;"></p>
<p>&#x6211;&#x4EEC;&#x5148;&#x6765;<a href="02-&#x642D;&#x5EFA;Electron&#x8FD0;&#x884C;&#x73AF;&#x5883;.html">&#x642D;&#x5EFA;&#x4E00;&#x4E2A;Electron&#x7684;&#x8FD0;&#x884C;&#x73AF;&#x5883;</a>&#x3002;</p>
<h3 id="2&#x3001;electron-&#x539F;&#x7406;"><a name="2&#x3001;electron-&#x539F;&#x7406;" class="anchor-navigation-ex-anchor" href="#2&#x3001;electron-&#x539F;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a><a name="2&#x3001;electron-&#x539F;&#x7406;" class="plugin-anchor" href="#2&#x3001;electron-&#x539F;&#x7406;"><i class="fa fa-link" aria-hidden="true"></i></a>2&#x3001;Electron &#x539F;&#x7406;</h3>
<p>&#x5728;&#x6DF1;&#x5165;&#x5B66;&#x4E60;Eelectron &#x4E4B;&#x524D;&#xFF0C;&#x6211;&#x4EEC;&#x6709;&#x5FC5;&#x8981;&#x4E86;&#x89E3;&#x4E00;&#x4E0B;Electron&#x7684;&#x5E94;&#x7528;&#x67B6;&#x6784;&#x3002;</p>
<p>Electron &#x8FD0;&#x884C;&#x5728;&#x4E24;&#x7C7B;&#x8FDB;&#x7A0B;&#x4E2D;&#xFF0C;&#x4E00;&#x7C7B;&#x662F;&#x4E3B;&#x8FDB;&#x7A0B;&#xFF0C;&#x4E00;&#x7C7B;&#x662F;&#x6E32;&#x67D3;&#x8FDB;&#x7A0B;
&#x6211;&#x4EEC;&#x8981;&#x77E5;&#x9053;&#xFF0C;electron&#x662F;&#x57FA;&#x4E8E;chromium&#x624D;&#x80FD;&#x5DE5;&#x4F5C;&#x7684;&#xFF0C;&#x90A3;&#x6211;&#x4EEC;&#x5C31;&#x5148;&#x7B80;&#x5355;&#x770B;&#x4E0B;chromium&#x67B6;&#x6784;&#xFF1A;</p>
<p><img src="images/Snip20200301_29.png" style="width:500px;"></p>
<p>chromium&#x8FD0;&#x884C;&#x65F6;&#x6709;&#x4E00;&#x4E2A;Browser Process&#xFF0C;&#x4EE5;&#x53CA;&#x4E00;&#x4E2A;&#x6216;&#x8005;&#x591A;&#x4E2A;Renderer Process&#x3002;Renderer Process &#x987E;&#x540D;&#x601D;&#x4E49;&#x8D1F;&#x8D23;&#x6E32;&#x67D3;Web&#x9875;&#x9762;&#x3002;Browser Process&#x5219;&#x8D1F;&#x8D23;&#x7BA1;&#x7406;&#x5404;&#x4E2A;Renderer Process&#x4EE5;&#x53CA;&#x5176;&#x4ED6;&#x90E8;&#x5206;&#xFF08;&#x6BD4;&#x5982;&#x83DC;&#x5355;&#x680F;&#xFF0C;&#x6536;&#x85CF;&#x5939;&#x7B49;&#x7B49;&#xFF09;&#x3002;</p>
<p>&#x6211;&#x4EEC;&#x518D;&#x6765;&#x770B;&#x770B;electron&#x5728;chromium&#x7684;&#x57FA;&#x7840;&#x4E0A;&#x505A;&#x4E86;&#x4EC0;&#x4E48;&#xFF1A;</p>
<p><img src="images/Snip20200301_30.png" style="width:500px;"></p>
<ul>
<li>Renderer Process</li>
</ul>
<p>&#x5728;electron&#x4E2D;&#xFF0C;&#x4ECD;&#x7136;&#x4F7F;&#x7528;Renderer Process&#x6E32;&#x67D3;&#x9875;&#x9762;&#xFF0C;&#x4E5F;&#x5C31;&#x662F;&#x8BF4;electron app&#x4F7F;&#x7528;Web&#x9875;&#x9762;&#x4F5C;&#x4E3A;UI&#x663E;&#x793A;&#xFF0C;&#x5E76;&#x4E14;&#x517C;&#x5BB9;&#x4F20;&#x7EDF;&#x7684;Web&#x9875;&#x9762;&#x3002;&#x4E0D;&#x540C;&#x7684;&#x662F;electron app&#x5F00;&#x53D1;&#x8005;&#x53EF;&#x4EE5;&#x53EF;&#x9009;&#x7684;&#x914D;&#x7F6E;&#x662F;&#x5426;&#x652F;&#x6301;Node.js&#x3002;</p>
<ul>
<li>Main Process</li>
</ul>
<p>electron&#x5BF9;Browser Process&#x6539;&#x52A8;&#x8F83;&#x5927;&#xFF0C;&#x5E72;&#x8106;&#x53E6;&#x8D77;&#x4E00;&#x4E2A;&#x540D;&#x5B57;&#x53EB;Main Process&#x3002;Main Process &#x9664;&#x4E86;&#x539F;&#x6765;chromium&#x7684;runtime&#xFF0C;&#x53C8;&#x6DFB;&#x52A0;&#x4E86;Node.js&#x7684;runtime&#xFF0C;main.js&#x4FBF;&#x8FD0;&#x884C;&#x5728;&#x6B64;&#x4E4B;&#x4E0A;&#x3002; </p>
<p>electron&#x5C06;Node.js&#x7684;message loop&#x548C;chromium&#x8054;&#x7CFB;&#x8D77;&#x6765;&#xFF0C;&#x4F7F;&#x5F97;js&#x4E2D;&#x53EF;&#x4EE5;&#x7075;&#x6D3B;&#x7684;&#x63A7;&#x5236;&#x9875;&#x9762;&#x663E;&#x793A;&#xFF0C;&#x4EE5;&#x53CA;&#x548C;Renderer Process&#x7684;IPC&#x901A;&#x4FE1;&#x3002; &#x8FDB;&#x7A0B;&#x95F4;&#x901A;&#x4FE1;(IPC,Inter-Process Communication)&#x6307;&#x81F3;&#x5C11;&#x4E24;&#x4E2A;&#x8FDB;&#x7A0B;&#x6216;&#x7EBF;&#x7A0B;&#x95F4;&#x4F20;&#x9001;&#x6570;&#x636E;&#x6216;&#x4FE1;&#x53F7;&#x7684;&#x4E00;&#x4E9B;&#x6280;&#x672F;&#x6216;&#x65B9;&#x6CD5;&#x3002;
&#x5F53;&#x7136;&#x539F;&#x751F;&#x7684;Node API&#x548C;&#x7B2C;&#x4E09;&#x65B9;&#x7684;node module&#x540C;&#x6837;&#x652F;&#x6301;&#xFF0C;&#x5E76;&#x4E14;&#x6709;electron API&#x63D0;&#x4F9B;&#x7ED9;&#x5F00;&#x53D1;&#x8005;&#x63A7;&#x5236;&#x539F;&#x751F;&#x83DC;&#x5355;&#x548C;&#x901A;&#x77E5;&#x7B49;&#x3002;
&#x6709;&#x4E00;&#x70B9;&#x9700;&#x8981;&#x6CE8;&#x610F;&#xFF0C;Browser Process&#x672C;&#x6765;&#x6CA1;&#x6709;js&#x8FD0;&#x884C;&#x65F6;&#xFF0C;&#x6240;&#x4EE5;&#x8FD8;&#x9700;&#x8981;&#x4F9D;&#x8D56;V8&#xFF08;&#x5F53;&#x7136;&#x8FD9;&#x662F;chromium&#x4E2D;&#x7684;V8&#xFF0C;&#x4E0D;&#x662F;&#x5355;&#x72EC;&#x7684;V8&#x5E93;&#xFF09;&#x3002;</p>
<p><img src="images/Snip20200301_31.png" style="width:500px;"></p>
<p>&#x603B;&#x7ED3;&#x4E00;&#x4E0B;&#xFF0C;&#x4E00;&#x4E2A;Main Process(&#x4E3B;&#x8FDB;&#x7A0B;&#xFF09;&#xFF0C;&#x4E00;&#x4E2A;&#x6216;&#x591A;&#x4E2A;Rederer(&#x6E32;&#x67D3;&#x8FDB;&#x7A0B;) &#x6784;&#x6210;&#x4E86;Electron&#x7684;&#x8FD0;&#x884C;&#x67B6;&#x6784;&#x3002;
&#x6211;&#x4EEC;&#x59D1;&#x4E14;&#x628A;&#x4E3B;&#x8FDB;&#x7A0B;&#x53EB;Server-side&#x670D;&#x52A1;&#x7AEF;&#xFF0C;&#x5C06;rederen process&#x53EB;&#x5BA2;&#x6237;&#x7AEF;&#x3002;</p>
<ul>
<li>electron &#x4F7F;&#x7528; Node.js &#x539F;&#x751F;&#x6A21;&#x5757;</li>
</ul>
<p><img src="images/Snip20200301_32.png" style="width:500px;">
<img src="images/node.png" style="width:500px;"></p>
<p>Node.js &#x539F;&#x751F;&#x6A21;&#x5757;&#x662F;&#x7528; C++ &#x7F16;&#x5199;&#x7684; Node.js &#x6269;&#x5C55;&#x3002;C++ &#x6E90;&#x7801;&#x901A;&#x8FC7; node-gyp &#x7F16;&#x8BD1;&#x4E3A; .node &#x540E;&#x7F00;&#x7684;&#x4E8C;&#x8FDB;&#x5236;&#x6587;&#x4EF6;&#xFF08;&#x7C7B;&#x4F3C;&#x4E8E; .dll &#x548C; .so&#xFF09;&#x3002;&#x5728; Node.js &#x73AF;&#x5883;&#x4E2D;&#x53EF;&#x4EE5;&#x76F4;&#x63A5;&#x7528; require() &#x51FD;&#x6570;&#x5C06; .node &#x6587;&#x4EF6;&#x521D;&#x59CB;&#x5316;&#x4E3A;&#x52A8;&#x6001;&#x94FE;&#x63A5;&#x5E93;&#x3002;&#x4E00;&#x4E9B; npm &#x5305;&#x4F1A;&#x5305;&#x542B; C++ &#x6269;&#x5C55;&#xFF0C;&#x4F8B;&#x5982;&#xFF1A; node-ffi&#x3001;node-iconv&#x3001;node-usb&#xFF0C;&#x4F46;&#x90FD;&#x662F;&#x6E90;&#x7801;&#x7248;&#x672C;&#xFF0C;&#x5728;&#x5B89;&#x88C5;&#x540E;&#x9700;&#x8981;&#x7F16;&#x8BD1;&#x540E;&#x624D;&#x80FD;&#x88AB; Node.js &#x8C03;&#x7528;&#x3002;
Electron &#x540C;&#x6837;&#x4E5F;&#x652F;&#x6301; Node &#x539F;&#x751F;&#x6A21;&#x5757;&#xFF0C;&#x4F46;&#x7531;&#x4E8E;&#x548C;&#x5B98;&#x65B9;&#x7684; Node &#x76F8;&#x6BD4;&#x4F7F;&#x7528;&#x4E86;&#x4E0D;&#x540C;&#x7684; V8 &#x5F15;&#x64CE;&#xFF0C;&#x5982;&#x679C;&#x4F60;&#x60F3;&#x7F16;&#x8BD1;&#x539F;&#x751F;&#x6A21;&#x5757;&#xFF0C;&#x5219;&#x9700;&#x8981;&#x624B;&#x52A8;&#x8BBE;&#x7F6E; Electron &#x7684; headers &#x7684;&#x4F4D;&#x7F6E;&#x3002;</p>

                                
                                </section>
                            
    </div>
    <div class="search-results">
        <div class="has-results">
            
            <h1 class="search-results-title"><span class='search-results-count'></span> results matching "<span class='search-query'></span>"</h1>
            <ul class="search-results-list"></ul>
            
        </div>
        <div class="no-results">
            
            <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
            
        </div>
    </div>
</div>

                        </div>
                    </div>
                
            </div>

            
                
                <a href="../" class="navigation navigation-prev " aria-label="Previous page: 前言">
                    <i class="fa fa-angle-left"></i>
                </a>
                
                
                <a href="01-Electron介绍.html" class="navigation navigation-next " aria-label="Next page: 01-Electron介绍">
                    <i class="fa fa-angle-right"></i>
                </a>
                
            
        
    </div>

    <script>
        var gitbook = gitbook || [];
        gitbook.push(function() {
            gitbook.page.hasChanged({"page":{"title":"基础","level":"1.2","depth":1,"next":{"title":"01-Electron介绍","level":"1.2.1","depth":2,"path":"basics/01-Electron介绍.md","ref":"./basics/01-Electron介绍.md","articles":[]},"previous":{"title":"前言","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["-sharing","splitter","expandable-chapters-small","anchors","github","github-buttons","sharing-plus","anchor-navigation-ex","favicon","insert-logo"],"styles":{"website":"./styles/website.css"},"pluginsConfig":{"github":{"url":"https://github.com/lurongtao/felixbooks-electron"},"splitter":{},"search":{},"sharing-plus":{"qq":false,"all":["facebook","google","twitter","instapaper","linkedin","pocket","stumbleupon"],"douban":false,"facebook":true,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":true,"messenger":false,"line":false,"vk":false,"pocket":true,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"lunr":{"maxIndexSize":1000000,"ignoreSpecialCharacters":false},"fontsettings":{"theme":"white","family":"sans","size":2},"highlight":{},"anchor-navigation-ex":{"associatedWithSummary":true,"float":{"floatIcon":"fa fa-navicon","level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"mode":"float","multipleH1":true,"pageTop":{"level1Icon":"","level2Icon":"","level3Icon":"","showLevelIcon":false},"printLog":false,"showGoTop":true,"showLevel":false},"favicon":{"shortcut":"./source/images/favicon.jpg","bookmark":"./source/images/favicon.jpg","appleTouch":"./source/images/apple-touch-icon.jpg","appleTouchMore":{"120x120":"./source/images/apple-touch-icon.jpg","180x180":"./source/images/apple-touch-icon.jpg"}},"github-buttons":{"buttons":[{"user":"lurongtao","repo":"felixbooks-electron","type":"star","size":"small","count":true}]},"expandable-chapters-small":{},"sharing":{"qq":false,"all":["google","facebook","weibo","twitter","qq","qzone","linkedin","pocket"],"douban":false,"facebook":false,"weibo":false,"instapaper":false,"whatsapp":false,"hatenaBookmark":false,"twitter":false,"messenger":false,"line":false,"vk":false,"pocket":false,"google":false,"viber":false,"stumbleupon":false,"qzone":false,"linkedin":false},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false},"anchors":{},"insert-logo":{"url":"/felixbooks-electron/images/logo.png","style":"background: skyblue; width: 100%; height: 100%;"}},"theme":"default","author":"古艺散人","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"千锋大前端小册-Electron","language":"zh-hans","links":{},"gitbook":"3.2.3","description":"Electron 入门与实战"},"file":{"path":"basics/01-Electron介绍.md","mtime":"2020-03-01T05:01:17.475Z","type":"markdown"},"gitbook":{"version":"3.2.3","time":"2020-03-01T09:39:06.010Z"},"basePath":"..","book":{"language":""}});
        });
    </script>
</div>

        
    <script src="../gitbook/gitbook.js"></script>
    <script src="../gitbook/theme.js"></script>
    
        
        <script src="../gitbook/gitbook-plugin-splitter/splitter.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-expandable-chapters-small/expandable-chapters-small.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-github-buttons/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-sharing-plus/buttons.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-insert-logo/plugin.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search-engine.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-search/search.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/lunr.min.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-lunr/search-lunr.js"></script>
        
    
        
        <script src="../gitbook/gitbook-plugin-fontsettings/fontsettings.js"></script>
        
    

    </body>
</html>

